package cn.lg.soar.database.util;

import cn.lg.soar.common.util.data.DataUtil;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collection;
import java.util.function.BiConsumer;
import java.util.function.Consumer;

/**
 * @author luguoxiang 469599794@qq.com
 * @Date: 2024/4/1 12:08
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
public interface MpSqlUtils {

    SqlHandler HANDLER = new SqlHandler(i -> "{"+ i +"}");

    /**
     * 获取in占位符
     * @param values
     * @return
     */
    static String getInPlaceholder(Collection<?> values) {
        return HANDLER.getInPlaceholder(values);
    }

    static void handleLikeStr(String value, BiConsumer<String, String> consumer) {
        HANDLER.handleLikeStr(value, consumer);
    }

    static void handleInOrEq(Collection<?> values, BiConsumer<String, Object[]> consumer) {
        HANDLER.handleInOrEq(values, consumer);
    }

    static void handleInOrEq(Object[] values, BiConsumer<String, Object[]> consumer) {
        HANDLER.handleInOrEq(values, consumer);
    }

    /**
     * 处理范围查询
     * @param start
     * @param end
     * @param consumer
     */
    static void handleRange(Object start, Object end, BiConsumer<String, Object[]> consumer) {
        HANDLER.handleRange(start, end, consumer);
    }

}
